home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIWebBrowserPersist.idl < prev    next >
Text File  |  2006-05-08  |  12KB  |  286 lines

  1. /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * ***** BEGIN LICENSE BLOCK *****
  4.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5.  *
  6.  * The contents of this file are subject to the Mozilla Public License Version
  7.  * 1.1 (the "License"); you may not use this file except in compliance with
  8.  * the License. You may obtain a copy of the License at
  9.  * http://www.mozilla.org/MPL/
  10.  *
  11.  * Software distributed under the License is distributed on an "AS IS" basis,
  12.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13.  * for the specific language governing rights and limitations under the
  14.  * License.
  15.  *
  16.  * The Original Code is the Mozilla browser.
  17.  *
  18.  * The Initial Developer of the Original Code is
  19.  * Netscape Communications, Inc.
  20.  * Portions created by the Initial Developer are Copyright (C) 1999
  21.  * the Initial Developer. All Rights Reserved.
  22.  *
  23.  * Contributor(s):
  24.  *   Adam Lock <adamlock@netscape.com>
  25.  *
  26.  * Alternatively, the contents of this file may be used under the terms of
  27.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  28.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29.  * in which case the provisions of the GPL or the LGPL are applicable instead
  30.  * of those above. If you wish to allow use of your version of this file only
  31.  * under the terms of either the GPL or the LGPL, and not to allow others to
  32.  * use your version of this file under the terms of the MPL, indicate your
  33.  * decision by deleting the provisions above and replace them with the notice
  34.  * and other provisions required by the GPL or the LGPL. If you do not delete
  35.  * the provisions above, a recipient may use your version of this file under
  36.  * the terms of any one of the MPL, the GPL or the LGPL.
  37.  *
  38.  * ***** END LICENSE BLOCK ***** */
  39.  
  40. #include "nsICancelable.idl"
  41.  
  42. interface nsIURI;
  43. interface nsIInputStream;
  44. interface nsIDOMDocument;
  45. interface nsIWebProgressListener;
  46. interface nsILocalFile;
  47. interface nsIChannel;
  48.  
  49. /**
  50.  * Interface for persisting DOM documents and URIs to local or remote storage.
  51.  *
  52.  * @status UNDER_REVIEW
  53.  */
  54. [scriptable, uuid(dd4e0a6a-210f-419a-ad85-40e8543b9465)]
  55. interface nsIWebBrowserPersist : nsICancelable
  56. {
  57.   /** No special persistence behaviour. */
  58.   const unsigned long PERSIST_FLAGS_NONE = 0;
  59.   /** Only use cached data (could result in failure if data is not cached). */
  60.   const unsigned long PERSIST_FLAGS_FROM_CACHE = 1;
  61.   /** Bypass the cached data. */
  62.   const unsigned long PERSIST_FLAGS_BYPASS_CACHE = 2;
  63.   /** Ignore any redirected data (usually adverts). */
  64.   const unsigned long PERSIST_FLAGS_IGNORE_REDIRECTED_DATA = 4;
  65.   /** Ignore IFRAME content (usually adverts). */
  66.   const unsigned long PERSIST_FLAGS_IGNORE_IFRAMES = 8;
  67.   /** Do not run the incoming data through a content converter e.g. to decompress it */
  68.   const unsigned long PERSIST_FLAGS_NO_CONVERSION = 16;
  69.   /** Replace existing files on the disk (use with due diligence!) */
  70.   const unsigned long PERSIST_FLAGS_REPLACE_EXISTING_FILES = 32;
  71.   /** Don't modify or add base tags */
  72.   const unsigned long PERSIST_FLAGS_NO_BASE_TAG_MODIFICATIONS = 64;
  73.   /** Make changes to original dom rather than cloning nodes */
  74.   const unsigned long PERSIST_FLAGS_FIXUP_ORIGINAL_DOM = 128;
  75.   /** Fix links relative to destination location (not origin) */
  76.   const unsigned long PERSIST_FLAGS_FIXUP_LINKS_TO_DESTINATION = 256;
  77.   /** Don't make any adjustments to links */
  78.   const unsigned long PERSIST_FLAGS_DONT_FIXUP_LINKS = 512;
  79.   /** Force serialization of output (one file at a time; not concurrent) */
  80.   const unsigned long PERSIST_FLAGS_SERIALIZE_OUTPUT = 1024;
  81.   /** Don't make any adjustments to filenames */
  82.   const unsigned long PERSIST_FLAGS_DONT_CHANGE_FILENAMES = 2048;
  83.   /** Fail on broken inline links */
  84.   const unsigned long PERSIST_FLAGS_FAIL_ON_BROKEN_LINKS = 4096;
  85.   /**
  86.    * Automatically cleanup after a failed or cancelled operation, deleting all
  87.    * created files and directories. This flag does nothing for failed upload
  88.    * operations to remote servers.
  89.    */
  90.   const unsigned long PERSIST_FLAGS_CLEANUP_ON_FAILURE = 8192;
  91.   /**
  92.    * Let the WebBrowserPersist decide whether the incoming data is encoded
  93.    * and whether it needs to go through a content converter e.g. to
  94.    * decompress it.
  95.    */
  96.   const unsigned long PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION = 16384;
  97.  
  98.  
  99.   /**
  100.    * Flags governing how data is fetched and saved from the network. 
  101.    * It is best to set this value explicitly unless you are prepared
  102.    * to accept the default values.
  103.    */
  104.   attribute unsigned long persistFlags;
  105.     
  106.   /** Persister is ready to save data */
  107.   const unsigned long PERSIST_STATE_READY = 1;
  108.   /** Persister is saving data */
  109.   const unsigned long PERSIST_STATE_SAVING = 2;
  110.   /** Persister has finished saving data */
  111.   const unsigned long PERSIST_STATE_FINISHED = 3;
  112.  
  113.   /**
  114.    * Current state of the persister object.
  115.    */
  116.   readonly attribute unsigned long currentState;
  117.  
  118.   /**
  119.    * Value indicating the success or failure of the persist
  120.    * operation.
  121.    *
  122.    * @return NS_OK Operation was successful or is still ongoing.
  123.    * @return NS_BINDING_ABORTED Operation cancelled.
  124.    * @return NS_ERROR_FAILURE Non-specific failure.
  125.    */
  126.   readonly attribute unsigned long result;
  127.  
  128.   /**
  129.    * Callback listener for progress notifications. The object that the
  130.    * embbedder supplies may also implement nsIInterfaceRequestor and be
  131.    * prepared to return nsIAuthPrompt or other interfaces that may be required
  132.    * to download data.
  133.    *
  134.    * @see nsIAuthPrompt
  135.    * @see nsIInterfaceRequestor
  136.    */
  137.   attribute nsIWebProgressListener progressListener;
  138.  
  139.   /**
  140.    * Save the specified URI to file.
  141.    *
  142.    * @param aURI       URI to save to file. Some implementations of this interface
  143.    *                   may also support <CODE>nsnull</CODE> to imply the currently
  144.    *                   loaded URI.
  145.    * @param aCacheKey  An object representing the URI in the cache or
  146.    *                   <CODE>nsnull</CODE>.
  147.    * @param aReferrer  The referrer URI to pass with an HTTP request or
  148.    *                   <CODE>nsnull</CODE>.
  149.    * @param aPostData  Post data to pass with an HTTP request or
  150.    *                   <CODE>nsnull</CODE>.
  151.    * @param aExtraHeaders Additional headers to supply with an HTTP request
  152.    *                   or <CODE>nsnull</CODE>.
  153.    * @param aFile      Target file. This may be a nsILocalFile object or an
  154.    *                   nsIURI object with a file scheme or a scheme that
  155.    *                   supports uploading (e.g. ftp).
  156.    *
  157.    * @see nsILocalFile
  158.    * @see nsIURI
  159.    * @see nsIInputStream
  160.    *
  161.    * @return NS_OK Operation has been started.
  162.    * @return NS_ERROR_INVALID_ARG One or more arguments was invalid.
  163.    */
  164.   void saveURI(in nsIURI aURI, in nsISupports aCacheKey,
  165.       in nsIURI aReferrer, in nsIInputStream aPostData,
  166.       in string aExtraHeaders, in nsISupports aFile);
  167.  
  168.   /**
  169.    * Save a channel to a file. It must not be opened yet.
  170.    * @see saveURI
  171.    */
  172.   void saveChannel(in nsIChannel aChannel, in nsISupports aFile);
  173.  
  174.   /** Output only the current selection as opposed to the whole document. */
  175.   const unsigned long ENCODE_FLAGS_SELECTION_ONLY = 1;
  176.   /**
  177.    * For plaintext output. Convert html to plaintext that looks like the html.
  178.    * Implies wrap (except inside <pre>), since html wraps.
  179.    * HTML output: always do prettyprinting, ignoring existing formatting.
  180.    */
  181.   const unsigned long ENCODE_FLAGS_FORMATTED = 2;
  182.   /**
  183.    * Output without formatting or wrapping the content. This flag
  184.    * may be used to preserve the original formatting as much as possible.
  185.    */
  186.   const unsigned long ENCODE_FLAGS_RAW = 4;
  187.   /** Output only the body section, no HTML tags. */
  188.   const unsigned long ENCODE_FLAGS_BODY_ONLY = 8;
  189.   /** Wrap even if when not doing formatted output (e.g. for text fields). */
  190.   const unsigned long ENCODE_FLAGS_PREFORMATTED = 16;
  191.   /** Wrap documents at the specified column. */
  192.   const unsigned long ENCODE_FLAGS_WRAP = 32;
  193.   /**
  194.    * For plaintext output. Output for format flowed (RFC 2646). This is used
  195.    * when converting to text for mail sending. This differs just slightly
  196.    * but in an important way from normal formatted, and that is that
  197.    * lines are space stuffed. This can't (correctly) be done later.
  198.    */
  199.   const unsigned long ENCODE_FLAGS_FORMAT_FLOWED = 64;
  200.   /** Convert links to absolute links where possible. */
  201.   const unsigned long ENCODE_FLAGS_ABSOLUTE_LINKS = 128;
  202.  
  203.   /** 
  204.    * Attempt to encode entities standardized at W3C (HTML, MathML, etc).
  205.    * This is a catch-all flag for documents with mixed contents. Beware of
  206.    * interoperability issues. See below for other flags which might likely
  207.    * do what you want.
  208.    */
  209.   const unsigned long ENCODE_FLAGS_ENCODE_W3C_ENTITIES = 256;
  210.  
  211.   /**
  212.    * Output with carriage return line breaks. May also be combined with
  213.    * ENCODE_FLAGS_LF_LINEBREAKS and if neither is specified, the platform
  214.    * default format is used.
  215.    */
  216.   const unsigned long ENCODE_FLAGS_CR_LINEBREAKS = 512;
  217.   /**
  218.    * Output with linefeed line breaks. May also be combined with
  219.    * ENCODE_FLAGS_CR_LINEBREAKS and if neither is specified, the platform
  220.    * default format is used.
  221.    */
  222.   const unsigned long ENCODE_FLAGS_LF_LINEBREAKS = 1024;
  223.   /** For plaintext output. Output the content of noscript elements. */
  224.   const unsigned long ENCODE_FLAGS_NOSCRIPT_CONTENT = 2048;
  225.   /** For plaintext output. Output the content of noframes elements. */
  226.   const unsigned long ENCODE_FLAGS_NOFRAMES_CONTENT = 4096;
  227.  
  228.   /**
  229.    * Encode basic entities, e.g. output   instead of character code 0xa0. 
  230.    * The basic set is just   & < > " for interoperability
  231.    * with older products that don't support α and friends.
  232.    */
  233.   const unsigned long ENCODE_FLAGS_ENCODE_BASIC_ENTITIES = 8192;
  234.   /**
  235.    * Encode Latin1 entities. This includes the basic set and
  236.    * accented letters between 128 and 255.
  237.    */
  238.   const unsigned long ENCODE_FLAGS_ENCODE_LATIN1_ENTITIES = 16384;
  239.   /**
  240.    * Encode HTML4 entities. This includes the basic set, accented
  241.    * letters, greek letters and certain special markup symbols.
  242.    */
  243.   const unsigned long ENCODE_FLAGS_ENCODE_HTML_ENTITIES = 32768;
  244.  
  245.   /**
  246.    * Save the specified DOM document to file and optionally all linked files
  247.    * (e.g. images, CSS, JS & subframes). Do not call this method until the
  248.    * document has finished loading!
  249.    *
  250.    * @param aDocument          Document to save to file. Some implementations of
  251.    *                           this interface may also support <CODE>nsnull</CODE>
  252.    *                           to imply the currently loaded document.
  253.    * @param aFile              Target local file. This may be a nsILocalFile object or an
  254.    *                           nsIURI object with a file scheme or a scheme that
  255.    *                           supports uploading (e.g. ftp).
  256.    * @param aDataPath          Path to directory where URIs linked to the document
  257.    *                           are saved or nsnull if no linked URIs should be saved.
  258.    *                           This may be a nsILocalFile object or an nsIURI object
  259.    *                           with a file scheme.
  260.    * @param aOutputContentType The desired MIME type format to save the 
  261.    *                           document and all subdocuments into or nsnull to use
  262.    *                           the default behaviour.
  263.    * @param aEncodingFlags     Flags to pass to the encoder.
  264.    * @param aWrapColumn        For text documents, indicates the desired width to
  265.    *                           wrap text at. Parameter is ignored if wrapping is not
  266.    *                           specified by the encoding flags.
  267.    *
  268.    * @see nsILocalFile
  269.    * @see nsIURI
  270.    *
  271.    * @return NS_OK Operation has been started.
  272.    * @return NS_ERROR_INVALID_ARG One or more arguments was invalid.
  273.    */
  274.   void saveDocument(in nsIDOMDocument aDocument,
  275.      in nsISupports aFile, in nsISupports aDataPath,
  276.      in string aOutputContentType, in unsigned long aEncodingFlags,
  277.      in unsigned long aWrapColumn);
  278.  
  279.   /**
  280.    * Cancels the current operation. The caller is responsible for cleaning up
  281.    * partially written files or directories. This has the same effect as calling
  282.    * cancel with an argument of NS_BINDING_ABORTED.
  283.    */
  284.   void cancelSave();
  285. };
  286.